package chapter03.src;

public class Bitwise {
    public static void main(String[] args){
        System.out.printf("And运算:");
        System.out.printf("0 and 0 %5d%n",0&0);
        System.out.printf("0 and 1 %5d%n",0&1);
        System.out.printf("1 and 0 %5d%n",1&0);
        System.out.printf("1 and 1 %5d%n",1&1);
        System.out.printf("\nOR 运算：");
        System.out.printf("0 or 0 %6d%n",0 | 0);
        System.out.printf("0 or 1 %6d%n",0 | 1);
        System.out.printf("1 or 0 %6d%n",1 | 0);
        System.out.printf("1 or 1 %6d%n",1 | 1);
        System.out.printf("\nXOR运算： ");
        System.out.printf("0 XOR 0 %5d%n",0^0);
        System.out.printf("0 XOR 1 %5d%n",0^1);
        System.out.printf("1 XOR 0 %5d%n",1^0);
        System.out.printf("1 XOR 1 %5d%n",1^1);
    }
}